<template>
  <div v-loading="loading">
    <el-tabs v-model="editableTabsValue">
      <el-tab-pane label="持量控盘" name="1">
        <el-form ref="form" label-width="100px" v-if="platform=='mxc'" style="margin-top: 30px;">
          <el-form-item label="是否原生" prop="pass">
            <el-switch
              v-model="localSwitch"
              active-color="#E76060"
              inactive-color="#BFBDBD">
            </el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="success" @click="lp">拉盘</el-button>
            <el-button type="danger" @click="zp">砸盘</el-button>
            <el-button type="primary" @click="zd">自动</el-button>
            <el-button type="primary" @click="czd">超自动</el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="dzd">单自动</el-button>
            <el-button type="primary" @click="tz">停止</el-button>
          </el-form-item>
          <el-form-item label="操作日志">
            <el-input type="textarea" v-model="localLog" :disabled="true" :rows="14"
                      size="large"></el-input>
          </el-form-item>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="原生控盘" name="2">
        <el-form ref="elForm2" :model="formData2" :rules="rules2" size="medium" label-width="100px" style="width: 90%">
          <el-form-item label="打压价格" prop="field101" required>
            <el-slider :step="0.0005" :min="towNumber(currentTick.price*0.7)" @change="changeLow"
                       :max="towNumber(currentTick.price*0.99)" v-model="formData2.field101"></el-slider>
          </el-form-item>
          <el-form-item label="比例打压" prop="field106">
            <el-radio-group v-model="formData2.field106" size="medium" @change="changeRateLow">
              <el-radio-button v-for="(item, index) in field106Options" :key="index" :label="item.value"
                               :disabled="item.disabled" border>{{ item.label }}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="拉升价格" prop="field102" required>
            <el-slider :step="0.0005" :min="towNumber(currentTick.price*1.01)" @change="changeHigh"
                       :max="towNumber(currentTick.price*1.3)" v-model="formData2.field102"></el-slider>
          </el-form-item>
          <el-form-item label="比例拉升" prop="field108">
            <el-radio-group v-model="formData2.field108" size="medium" @change="changeRateHigh">
              <el-radio-button v-for="(item, index) in field108Options" :key="index" :label="item.value"
                               :disabled="item.disabled" border>{{ item.label }}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-row type="flex" justify="start" align="top">
            <el-form-item label="执行价格" prop="field103">
              <el-input v-model="formData2.price" placeholder="请输入执行价格" :disabled='!formData2.field104' clearable
                        :style="{width: '100%'}"></el-input>
            </el-form-item>
            <el-form-item label="手动指定">
              <el-switch v-model="formData2.field104"></el-switch>
            </el-form-item>
          </el-row>
          <el-form-item label="延续时间" prop="field104">
            <el-input-number v-model="formData2.lastMinutes" placeholder="延续时间"></el-input-number>
          </el-form-item>
          <el-form-item size="large">
            <el-button v-if="action.direction==1" type="success" @click="submitFormelForm21">原生拉升</el-button>
            <el-button v-else-if="action.direction==2" type="danger" @click="submitFormelForm22">原生打压</el-button>
            <el-button v-else type="primary" @click="submitFormelForm2">原生执行</el-button>
            <el-button @click="resetFormelForm2">重置</el-button>
          </el-form-item>
          <el-form-item label="操作日志" prop="field107">
            <el-input v-model="formData2.log" type="textarea" placeholder="请输入操作日志" readonly
                      :rows="14" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="精准控盘" name="3">
        <el-form ref="elForm3" :model="formData3" :rules="rules3" size="medium" label-width="100px" style="width: 90%">
          <el-form-item label="精准低价" prop="field101" required>
            <el-slider :step="0.0001" :min="towNumber(currentTick.price*0.9)" @change="jzChangeLow"
                       :max="towNumber(currentTick.price)" v-model="formData3.field101"></el-slider>
          </el-form-item>
          <el-form-item label="比例低价" prop="field106">
            <el-radio-group v-model="formData3.field106" size="medium" @change="jzChangeRateLow">
              <el-radio-button v-for="(item, index) in field106Options" :key="index" :label="item.value"
                               :disabled="item.disabled" border>{{ item.label }}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="精准高价" prop="field102" required>
            <el-slider :step="0.0001" :min="towNumber(currentTick.price)" @change="jzChangeHigh"
                       :max="towNumber(currentTick.price*1.1)" v-model="formData3.field102"></el-slider>
          </el-form-item>
          <el-form-item label="比例高价" prop="field108">
            <el-radio-group v-model="formData3.field108" size="medium" @change="jzChangeRateHigh">
              <el-radio-button v-for="(item, index) in field108Options" :key="index" :label="item.value"
                               :disabled="item.disabled" border>{{ item.label }}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-row type="flex" justify="start" align="top">
            <el-form-item label="执行价格" prop="field103">
              <el-input v-model="formData3.price" placeholder="请输入执行价格" :disabled='!formData3.field104' clearable
                        :style="{width: '100%'}"></el-input>
            </el-form-item>
            <el-form-item label="手动指定">
              <el-switch v-model="formData3.field104"></el-switch>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="执行数量" prop="field105">
              <el-input v-model="formData3.field105" placeholder="请输入执行数量" clearable :style="{width: '100%'}">
              </el-input>
            </el-form-item>
          </el-row>
          <el-form-item label="执行账号" prop="field106">
            <el-radio-group v-model="formData3.field109" size="medium">
              <el-radio v-for="(item, index) in field109Options" :key="index" :label="item.value"
                        :disabled="item.disabled">{{ item.label }}
              </el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item size="large">
            <el-button type="success" @click="submitFormelForm31">精准买入</el-button>
            <el-button type="danger" @click="submitFormelForm32">精准卖出</el-button>
            <el-button @click="resetFormelForm3">重置</el-button>
          </el-form-item>
          <el-form-item label="操作日志" prop="field107">
            <el-input v-model="formData3.log" type="textarea" placeholder="请输入操作日志" readonly
                      :rows="14" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-form>
      </el-tab-pane >
      <el-tab-pane label="计划控盘" name="4" >
        <TriggerControl :platform="this.platform" :runningId="this.runningId"></TriggerControl>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import {
  getTicker,
  placeOrder,
  safeStop,
  configAction
} from "@/api/platform/running";

import axios from 'axios'

import TriggerControl from "./TriggerControl"

export default {
  components: {TriggerControl},
  props: {
    platform: null,
    runningId: null,
  },
  data() {
    return {
      localSwitch: true,
      localLog: "",

      loading: false,
      currentTick: {
        price: undefined
      },
      editableTabsValue: '1',
      formData1: {
        mobile: '',
        field101: undefined,
      },
      rules1: {},
      field101Options: [{
        "label": "选项一",
        "value": 1
      }, {
        "label": "选项二",
        "value": 2
      }],
      formData2: {
        field101: 0,
        field106: 1,
        field102: 0,
        field104: false,
        field108: 1,
        price: undefined,
        lastMinutes: 3,
        log: "",
      },
      rules2: {},
      field106Options: [{
        "label": "打压1‰",
        "value": 1
      }, {
        "label": "打压2‰",
        "value": 2
      }, {
        "label": "打压3‰",
        "value": 3
      }, {
        "label": "打压4‰",
        "value": 4
      }, {
        "label": "打压5‰",
        "value": 5
      }, {
        "label": "打压6‰",
        "value": 6
      }, {
        "label": "打压7‰",
        "value": 7
      }, {
        "label": "打压8‰",
        "value": 8
      }, {
        "label": "打压9‰",
        "value": 9
      }, {
        "label": "打压10‰",
        "value": 10
      }, {
        "label": "打压2%",
        "value": 20
      }, {
        "label": "打压3%",
        "value": 30
      }, {
        "label": "打压4%",
        "value": 40
      }, {
        "label": "打压5%",
        "value": 50
      }, {
        "label": "打压10%",
        "value": 100
      }],
      field108Options: [{
        "label": "拉升1‰",
        "value": 1
      }, {
        "label": "拉升2‰",
        "value": 2
      }, {
        "label": "拉升3‰",
        "value": 3
      }, {
        "label": "拉升4‰",
        "value": 4
      }, {
        "label": "拉升5‰",
        "value": 5
      }, {
        "label": "拉升6‰",
        "value": 6
      }, {
        "label": "拉升7‰",
        "value": 7
      }, {
        "label": "拉升8‰",
        "value": 8
      }, {
        "label": "拉升9‰",
        "value": 9
      }, {
        "label": "拉升10‰",
        "value": 10
      }, {
        "label": "拉升2%",
        "value": 20
      }, {
        "label": "拉升3%",
        "value": 30
      }, {
        "label": "拉升4%",
        "value": 40
      }, {
        "label": "拉升5%",
        "value": 50
      }, {
        "label": "拉升10%",
        "value": 100
      }],
      field109Options: [{
        "label": "深度账户",
        "value": "depth"
      }, {
        "label": "k线账户",
        "value": "kline"
      }],
      formData3: {
        field101: 0,
        field106: 1,
        field109: "depth",
        field102: 0,
        field108: 1,
        price: undefined,
        field104: false,
        field105: undefined,
        log: "",
      },
      rules3: {},
      action: {
        price: undefined,
        direction: undefined,
        lastMinutes: 3,
      },
      jzAction: {
        price: undefined,
        dealType: undefined,
        quality: 0,
        platform: this.platform,
        type: ''
      },
      jzHpForm: {
        stopts: 30
      }
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getTick();
  },
  mounted() {
    this.getTick();
  },
  methods: {
    getTick() {
      getTicker(this.runningId, {platform: this.platform}).then(res => {
        this.currentTick.price = res.data.price
        this.formData2.field101 = this.towNumber(this.currentTick.price);
        this.formData2.field102 = this.towNumber(this.currentTick.price);
        this.formData2.price = this.towNumber(this.currentTick.price);

        this.formData3.field101 = this.towNumber(this.currentTick.price);
        this.formData3.field102 = this.towNumber(this.currentTick.price);
        this.formData3.price = this.towNumber(this.currentTick.price);
      })
    },
    towNumber(val) {
      return Number(Number(val).toFixed(5))
    },
    submitFormelForm1() {
      this.$refs['elForm1'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetFormelForm1() {
      this.$refs['elForm1'].resetFields()
    },
    submitFormelForm21() {
      this.$refs['elForm2'].validate(valid => {
        if (!valid) return
        this.yslp()
      })
    },
    submitFormelForm22() {
      this.$refs['elForm2'].validate(valid => {
        if (!valid) return
        this.yszp()
      })
    },
    submitFormelForm2() {
      this.$refs['elForm2'].validate(valid => {
        if (!valid) return
      })
    },
    resetFormelForm2() {
      this.$refs['elForm2'].resetFields()
      this.action = {
        price: undefined,
        direction: undefined,
        lastMinutes: 3,
      }
      this.getTick()
    },
    submitFormelForm31() {
      this.$refs['elForm3'].validate(valid => {
        if (!valid) return
        this.jzYslp()
      })
    },
    submitFormelForm32() {
      this.$refs['elForm3'].validate(valid => {
        if (!valid) return
        this.jzYszp()
      })
    },
    resetFormelForm3() {
      this.$refs['elForm3'].resetFields()
      this.jzAction = {
        price: undefined,
        dealType: undefined,
        quality: 0,
        platform: this.platform,
        type: ''
      }
      this.getTick()
    },

    changeHigh(value) {
      this.action.direction = 1
      this.formData2.price = value
    },
    changeLow(value) {
      this.action.direction = 2
      this.formData2.price = value
    },

    jzChangeHigh(value) {
      this.formData3.price = value
    },
    jzChangeLow(value) {
      this.formData3.price = value
    },

    changeRateHigh(value) {
      this.action.direction = 1
      this.formData2.price = this.towNumber((1000 + value) * this.towNumber(this.currentTick.price) / 1000)
    },
    changeRateLow(value) {
      this.action.direction = 2
      this.formData2.price = this.towNumber((1000 - value) * this.towNumber(this.currentTick.price) / 1000)
    },

    jzChangeRateHigh(value) {
      this.formData3.price = this.towNumber((1000 + value) * this.towNumber(this.currentTick.price) / 1000)
    },
    jzChangeRateLow(value) {
      this.formData3.price = this.towNumber((1000 - value) * this.towNumber(this.currentTick.price) / 1000)
    },
    yslp() {
      this.formData2.log = "1> 拉盘开始：" + new Date().toISOString() + "\r\n" + this.formData2.log;
      this.loading = true
      this.action.price = this.formData2.price
      this.action.platform=this.platform
      this.action.lastMinutes = this.formData2.lastMinutes
      this.formData2.log = "   拉盘参数：(" + JSON.stringify(this.action) + ")" + new Date().toISOString() + "\r\n" + this.formData2.log;
      configAction(this.runningId, this.action).then(res => {
        this.formData2.log = "2> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.formData2.log;
        this.loading = false
        this.formData2.log = "3> 拉盘结束：" + new Date().toISOString() + "\r\n" + this.formData2.log;
        this.formData2.log = "=============================================\r\n" + this.formData2.log;
      })
    },
    yszp() {
      this.formData2.log = "1> 砸盘开始：" + new Date().toISOString() + "\r\n" + this.formData2.log;
      this.loading = true
      this.action.price = this.formData2.price
      this.action.platform=this.platform
      this.action.lastMinutes = this.formData2.lastMinutes
      this.formData2.log = "   砸盘参数：(" + JSON.stringify(this.action) + ")" + new Date().toISOString() + "\r\n" + this.formData2.log;
      configAction(this.runningId, this.action).then(res => {
        this.formData2.log = "2> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.formData2.log;
        this.loading = false
        this.formData2.log = "3> 砸盘结束：" + new Date().toISOString() + "\r\n" + this.formData2.log;
        this.formData2.log = "=============================================\r\n" + this.formData2.log;
      })
    },
    jzYslp() {
      this.jzAction.quality = this.formData3.field105
      this.jzAction.type = this.formData3.field109
      this.jzAction.price = this.formData3.price
      if (this.checkType()) return
      if (this.checkQty()) return
      // if (this.hpForm.startTs < 30 || this.hpForm.startTs > 300) return
      this.loading = true
      this.formData3.log = "1> 预留停用K线： " + this.jzHpForm.stopts + " 秒 " + new Date().toISOString() + "\r\n" + this.formData3.log;
      safeStop(this.runningId, {platform: this.platform, delay: this.jzHpForm.stopts}).then(res => {
        if (res.code == 200) {
          this.formData3.log = "2> 预留停用k线完成： " + this.jzHpForm.stopts + " 秒 " + new Date().toISOString() + "\r\n" + this.formData3.log;
          this.formData3.log = "3> 拉盘开始：" + new Date().toISOString() + "\r\n" + this.formData3.log;
          this.jzAction.dealType = 'BID'
          this.formData3.log = "   拉盘参数：(" + JSON.stringify(this.jzAction) + ")" + new Date().toISOString() + "\r\n" + this.formData3.log;
          // this.jzAction.price = this.jzHpForm.highPrice
          placeOrder(this.runningId, this.jzAction).then(res => {
            if (res.code == 200) {
              this.formData3.log = "4> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.formData3.log;
              // this.orderId = res.data.data
              this.loading = false
              this.formData3.log = "5> 拉盘结束：" + new Date().toISOString() + "\r\n" + this.formData3.log;
              this.formData3.log = "=============================================\r\n" + this.formData3.log;
            } else {
              this.loading = false
              this.formData3.log = "4> 请求结果：" + new Date().toISOString() + "[失败]\r\n" + this.formData3.log;
              this.formData3.log = "=============================================\r\n" + this.formData3.log;
            }
          })
        }
      })

    },
    jzYszp() {
      this.jzAction.price = this.formData3.price
      this.jzAction.quality = this.formData3.field105
      this.jzAction.type = this.formData3.field109
      if (this.checkType()) return
      if (this.checkQty()) return
      // if (this.hpForm.startTs < 30 || this.hpForm.startTs > 300) return
      this.loading = true
      this.formData3.log = "1> 预留停用K线： " + this.jzHpForm.stopts + " 秒 " + new Date().toISOString() + "\r\n" + this.formData3.log;
      safeStop(this.runningId, {platform: this.platform, delay: this.jzHpForm.stopts}).then(res => {
        if (res.code == 200) {
          this.formData3.log = "2> 预留停用k线完成： " + this.jzHpForm.stopts + " 秒 " + new Date().toISOString() + "\r\n" + this.formData3.log;
          this.formData3.log = "3> 砸盘开始：" + new Date().toISOString() + "\r\n" + this.formData3.log;
          this.jzAction.dealType = "ASK"
          this.formData3.log = "   砸盘参数：(" + JSON.stringify(this.jzAction) + ")" + new Date().toISOString() + "\r\n" + this.formData3.log;
          // this.jzAction.price = this.jzHpForm.lowPrice
          placeOrder(this.runningId, this.jzAction).then(res => {
            if (res.code == 200) {
              this.formData3.log = "4> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.formData3.log;
              // this.orderId = res.data.data
              this.loading = false
              this.formData3.log = "5> 砸盘结束：" + new Date().toISOString() + "\r\n" + this.formData3.log;
              this.formData3.log = "=============================================\r\n" + this.formData3.log;
            } else {
              this.loading = false
              this.formData3.log = "4> 请求结果：" + new Date().toISOString() + "[失败]\r\n" + this.formData3.log;
              this.formData3.log = "=============================================\r\n" + this.formData3.log;
            }
          })
        }
      })

    },
    checkType() {
      if (this.jzAction.type == '' || this.jzAction.type == undefined || this.jzAction.type == null) {
        this.$message({
          message: '请输入账户类型',
          type: 'error'
        });
        console.log("check true")
        return true
      } else {
        console.log("check false")
        return false
      }
    },
    checkQty() {
      if (this.jzAction.quality == 0 || this.jzAction.quality == undefined || this.jzAction.quality == null) {
        this.$message({
          message: '请输入执行数量',
          type: 'error'
        });
        console.log("check true")
        return true
      } else {
        console.log("check false")
        return false
      }
    },


    lp() {
      this.localLog = "1> 拉盘开始：" + new Date().toISOString() + "\r\n" + this.localLog;
      this.loading = true
      if (this.localSwitch) {//192.138.210.150
        axios.get('http://119.28.75.118:5188/bf?mbo=1&ss=knight2012').then(res => {
          this.localLog = "2> 请求结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 拉盘结束[原]：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })

      } else {
        axios.get('http://119.28.75.118:5188/bf?mbo=1&ss=knight2012').then(res => {
          this.localLog = "2> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 拉盘结束：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })

      }

    },
    zp() {
      if (this.localSwitch) {//192.138.210.150
        this.localLog = "1> 砸盘开始：" + new Date().toISOString() + "\r\n" + this.localLog;
        this.loading = true
        axios.get('http://119.28.75.118:5188/bf?mbo=2&ss=knight2012').then(res => {
          this.localLog = "2> 请求结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 砸盘结束[原]：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      } else {
        this.localLog = "1> 砸盘开始：" + new Date().toISOString() + "\r\n" + this.localLog;
        this.loading = true
        axios.get('http://119.28.75.118:5188/bf?mbo=2&ss=knight2012').then(res => {
          this.localLog = "2> 请求结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 砸盘结束：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      }
    },
    zd() {
      this.localLog = "1> 机器人启动：" + new Date().toISOString() + "\r\n" + this.localLog;
      this.loading = true
      if (this.localSwitch) {//192.138.210.150
        axios.get('http://119.28.75.118:5188/bf?mbo=3&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      } else {
        axios.get('http://119.28.75.118:5188/bf?mbo=3&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      }
    },
    dzd() {
      this.localLog = "1> 机器人启动：" + new Date().toISOString() + "\r\n" + this.localLog;
      this.loading = true
      if (this.localSwitch) {//192.138.210.150
        axios.get('http://119.28.75.118:5188/bf?mbo=5&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      } else {
        axios.get('http://119.28.75.118:5188/bf?mbo=5&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      }
    },
    tz() {
      this.localLog = "1> 机器人启动：" + new Date().toISOString() + "\r\n" + this.localLog;
      this.loading = true
      if (this.localSwitch) {//192.138.210.150
        axios.get('http://119.28.75.118:5188/bf?mbo=-1&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      } else {
        axios.get('http://119.28.75.118:5188/bf?mbo=-1&ss=knight2012').then(res => {
          this.localLog = "2> 机器人启动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人启动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      }
    },
    czd() {
      this.localLog = "1> 机器人超自动：" + new Date().toISOString() + "\r\n" + this.localLog;
      this.loading = true
      if (this.localSwitch) {//192.138.210.150
        axios.get('http://119.28.75.118:5188/bf?mbo=4&ss=knight2012').then(res => {
          this.localLog = "2> 机器人超自动结果[原]：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人超自动完成[原]：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      } else {
        axios.get('http://119.28.75.118:5188/bf?mbo=4&ss=knight2012').then(res => {
          this.localLog = "2> 机器人超自动结果：" + new Date().toISOString() + "[" + res.data + "]\r\n" + this.localLog;
          this.loading = false
          this.localLog = "3> 机器人超自动完成：" + new Date().toISOString() + "\r\n" + this.localLog;
          this.localLog = "=============================================\r\n" + this.localLog;
        })
      }
    }
  }
}

</script>
<style>
</style>
